/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Simulation_InterfaceForm.java
 *
 * Created on Nov 30, 2011, 7:42:15 AM
 */
package fmii.ui;

import fmii.control.ModelControl;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;

/**
 *
 * @author Josh
 */
public class Model_Editor_Interface extends javax.swing.JPanel {

    /** Creates new form Simulation_InterfaceForm */
    public Model_Editor_Interface() {
        initComponents();
        
        control = new ModelControl();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        help_button = new javax.swing.JButton();
        mass_pred = new javax.swing.JComboBox();
        force_pred = new javax.swing.JComboBox();
        friction_pred = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();

        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(fmii.MainApp.class).getContext().getResourceMap(Model_Editor_Interface.class);
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        help_button.setText(resourceMap.getString("help_button.text")); // NOI18N
        help_button.setName("help_button"); // NOI18N
        help_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                help_buttonActionPerformed(evt);
            }
        });

        mass_pred.setMaximumRowCount(3);
        mass_pred.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "not change", "decrease", "increase" }));
        mass_pred.setName("mass_pred"); // NOI18N
        mass_pred.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mass_predActionPerformed(evt);
            }
        });

        force_pred.setMaximumRowCount(3);
        force_pred.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "not change", "decrease", "increase" }));
        force_pred.setName("force_pred"); // NOI18N
        force_pred.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                force_predActionPerformed(evt);
            }
        });

        friction_pred.setMaximumRowCount(3);
        friction_pred.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "not change", "decrease", "increase" }));
        friction_pred.setName("friction_pred"); // NOI18N
        friction_pred.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                friction_predActionPerformed(evt);
            }
        });

        jLabel5.setFont(resourceMap.getFont("jLabel5.font")); // NOI18N
        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jLabel4.setFont(resourceMap.getFont("jLabel4.font")); // NOI18N
        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel3.setFont(resourceMap.getFont("jLabel3.font")); // NOI18N
        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 194, Short.MAX_VALUE)
                        .addComponent(help_button))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel3)
                            .addComponent(jLabel4)
                            .addComponent(jLabel5))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(friction_pred, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(force_pred, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(mass_pred, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLabel2))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(help_button))
                .addGap(28, 28, 28)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(mass_pred, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(force_pred, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(friction_pred, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(60, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void help_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_help_buttonActionPerformed
         JOptionPane.showMessageDialog(null, control.give_help());
         String hint = "";         // call give_help in Model_Control         // hint = Model_Control.give_help();         message_to_user(hint);     }//GEN-LAST:event_help_buttonActionPerformed
    }        
        private void mass_predActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mass_predActionPerformed
            JComboBox jcmbType = (JComboBox) evt.getSource();
            int selection = jcmbType.getSelectedIndex();
            control.edit_massEffect(selection);
    }//GEN-LAST:event_mass_predActionPerformed

    private void force_predActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_force_predActionPerformed
        JComboBox jcmbType = (JComboBox) evt.getSource();
        int selection = jcmbType.getSelectedIndex();
        control.edit_forceEffect(selection);
    }//GEN-LAST:event_force_predActionPerformed

    private void friction_predActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_friction_predActionPerformed
        JComboBox jcmbType = (JComboBox) evt.getSource();
        int selection = jcmbType.getSelectedIndex();
        control.edit_frictionEffect(selection);
    }//GEN-LAST:event_friction_predActionPerformed

    // RUN SIMULATION (button)    }    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JComboBox force_pred;
    private javax.swing.JComboBox friction_pred;
    private javax.swing.JButton help_button;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JComboBox mass_pred;
    // End of variables declaration//GEN-END:variables

    ModelControl control;
}
